<script>
export default {
  name: "WorkOrderView",
  data() {
    return {
      list: [],
      value0:{}
    }
  },
  methods: {
    // 回到主页
    index(){
      this.$router.push('/')
    },
    //查询
    findAll(){
      this.axios.post(`http://localhost:9999/api-work-order-service/work-order/findAll`, this.value0).then(res => {
        this.list = res.data.data;
        console.log(res)
        console.log(this.list)
      })
    },
    //详情
    xq(id,type){
      if(type==1){
        this.$router.push({path: '/work_order_xq', query: {id: id}})
      }else if(type==2){
        this.$router.push({path: '/work_order_xq2', query: {id: id}})
      }else if(type==3){
        this.$router.push({path: '/work_order_xq3', query: {id: id}})
      }
    }

  },
  created() {
    this.findAll()
  }
}

</script>

<template>
    <div id="app">
      <div>
        <van-nav-bar style="float: left;font-size: 20px" @click-left="index()" left-arrow/>
        <h5 style="font-size: 20px;margin-left: 40%;height: 40px">维保工单</h5>
      </div>
      <div id="btl">
        <div id="xx">
          <span>工单日期</span>
          <van-icon name="arrow-down"/>&nbsp;&nbsp;&nbsp;<span style="font-size: 20px">|</span>
        </div>
        <div id="xx">
          <span>优先级</span>
          <van-icon name="arrow-down"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="font-size: 20px">|</span>
        </div>
        <div id="xx">
          <span>工单类别</span>
          <van-icon name="arrow-down"/>&nbsp;&nbsp;&nbsp;&nbsp;<span style="font-size: 20px">|</span>
        </div>
        <div id="xx">
          <span>全部</span>
        </div>
      </div>
      <div id="zssj" v-for="item in list">
        <div id="xl">
          <span>工单编号: {{item.workOrderNumber}}</span>         <span id="zt" v-if="item.status==1">普通</span> <span id="zt" v-if="item.status==2">紧急</span> <span id="zt" v-if="item.status==3">特急</span> <br>
          <span>工单类别: {{item.workOrderType==1?'维修':item.workOrderType==2?'维保':'巡检'}}</span><br>
          <span>工单时间: {{item.workOrderTime}}</span>  <van-button v-model="item.workOrderId" id="ann" type="info" @click="xq(item.workOrderId,item.workOrderType)">详情</van-button> <van-button v-if="1!=1" id="ann" type="info">详情2</van-button>
        </div>
      </div>

    </div>


<!--  </div>-->
</template>

<style scoped>
#ann{
  float: right;
  margin-right: 20px;
  margin-top: -20px;
  width: 60px;
  height: 35px;
}

#zt{
  float: right;
  margin-right: 25px;
}


#zssj {
  background-color: whitesmoke;
  margin-top: 5px;
}

#xl {
  //background-color: dodgerblue;
  margin-top: 5px;
  width: 100%;
  padding-left: 10px;
  //margin-left: 10px;
  //border: 1px solid #666;
}


#btl {
  width: 100%;
  height: 35px;
  background-color: blue;
  margin-top: -35px;
}

#app {
  margin-top: -80px;
}

#xx {
  float: left;
  font-size: 12px;
  color: white;
  width: 25%;
  height: 35px;
  text-align: center;
  line-height: 35px;
}
</style>